/*
 * @Description: 结算单表单声明函数
 * @Autor: 何兴家
 * @Date: 2021-01-07 09:49:57
 * @LastEditors: 何兴家
 * @LastEditTime: 2021-02-08 13:46:10
 */

//  工单信息
export const createOrderInfoList = function() {
  return [
    {
      type: 'INPUT',
      label: '工单号',
      fieldName: 'RO_NO',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'SELECT',
      label: '维修类型',
      fieldName: 'REPAIR_TYPE_CODE',
      disabled: true,
      itemList: [],
      initialValue: ''
    },
    {
      type: 'SELECT',
      label: '服务顾问',
      fieldName: 'SERVICE_ADVISOR',
      disabled: true,
      itemList: [],
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '开单日期',
      disabled: true,
      fieldName: 'RO_CREATE_DATE',
      initialValue: ''
    },
    {
      type: 'SELECT',
      label: '希望联系方式',
      fieldName: 'DELIVERER_HOBBY_CONTACT',
      itemList: this.createDictList(1012)
    },
    {
      type: 'SELECT',
      label: '电访时间',
      fieldName: 'TRACE_TIME',
      itemList: this.createDictList(8029)
    },
    {
      type: 'INPUT',
      label: '行驶里程',
      disabled: true,
      fieldName: 'IN_MILEAGE',
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '检查结果',
      disabled: true,
      fieldName: 'CHECK_RESULT',
      selfCols: 2,
      initialValue: ''
    }
  ];
};

// 车主车辆信息
export const createCarOwnerFormList = function() {
  return [
    {
      type: 'INPUT',
      label: '车牌号',
      fieldName: 'LICENSE',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: 'VIN',
      fieldName: 'VIN',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '车主',
      fieldName: 'OWNER_NAME',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '送修人',
      fieldName: 'DELIVERER',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '品牌',
      fieldName: 'BRAND_NAME',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '车系',
      fieldName: 'SERIES_NAME',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '车型',
      fieldName: 'MODEL_NAME',
      disabled: true,
      initialValue: ''
    }
  ];
};

// 配件销售单信息
export const createPartSaleFormList = function() {
  return [
    {
      type: 'INPUT',
      label: '配件销售单号',
      fieldName: 'SALES_PART_NO',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'SELECT',
      label: '客户类型',
      fieldName: 'CUSTOMER_TYPE',
      // itemList: this.createDictList(1038, [10381003, 10381004]),
      itemList: [
        { text: '客户', value: 'customer' },
        { text: '车主', value: 'vehicleOwner' }
      ],
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '供应商名称',
      fieldName: 'OWNER_NAME',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '开单日期',
      fieldName: 'CREATED_AT',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '备注',
      fieldName: 'REMARK',
      disabled: true,
      selfCols: 2,
      initialValue: ''
    }
  ];
};

// 结算单信息
export const createBallanceFormList = function() {
  return [
    {
      type: 'INPUT',
      label: '结算单号',
      fieldName: 'BALANCE_NO',
      disabled: true,
      initialValue: ''
    },
    {
      type: 'INPUT',
      label: '结算单备注',
      fieldName: 'REMARKDETAIL',
      disabled: false,
      selfCols: 2,
      initialValue: ''
    }
  ];
};

// 费用信息
export const createCostInfoFormList = function() {
  return [
    {
      type: 'SELECT',
      label: '优惠模式',
      fieldName: 'discountModeCode',
      disabled: false,
      itemList: [],
      change: this.handleDiscountModeChange
    },
    {
      type: 'SELECT',
      label: '付款方式',
      fieldName: 'payTypeCode',
      itemList: this.createDictList('8044', [80441010]).map(item => ({ text: item.text, value: item.value + '' }))
    },
    {
      type: 'CHECKBOX',
      label: '是否欠款结算',
      fieldName: 'arrBalance',
      initialValue: 0
    },
    {
      type: 'INPUT_NUMBER',
      label: '汇总金额',
      fieldName: 'receiveAmount',
      disabled: true,
      precision: 2,
      isControls: false
    },
    {
      type: 'INPUT_NUMBER',
      label: '实收金额',
      fieldName: 'calcRealTotalAmount',
      disabled: true,
      min: -Infinity,
      initialValue: 0,
      isControls: false,
      precision: 2
    },
    {
      type: 'INPUT',
      label: '税率',
      fieldName: 'tax',
      disabled: true
    },
    {
      type: 'INPUT_NUMBER',
      label: '税额',
      fieldName: 'taxAmount',
      disabled: true,
      precision: 2
    },
    {
      type: 'INPUT_NUMBER',
      label: '不含税金额',
      fieldName: 'netAmount',
      disabled: true,
      precision: 2
    },
    {
      type: 'INPUT_NUMBER',
      label: '去零金额',
      fieldName: 'subObbAmount',
      initialValue: '0.00',
      disabled: true,
      precision: 2
    },
    {
      type: 'INPUT_NUMBER',
      label: '元整金额',
      fieldName: 'yzAmaount',
      min: -Infinity,
      initialValue: 0,
      disabled: true,
      precision: 2
    },
    {
      type: 'INPUT_NUMBER',
      label: '合计优惠金额',
      precision: 2,
      fieldName: 'discountAmount',
      disabled: true
    },
    {
      type: 'INPUT_NUMBER',
      label: '自费总金额',
      fieldName: 'calcReceiveAmount',
      precision: 2,
      disabled: true
    },
    {
      type: 'INPUT_NUMBER',
      label: '索赔成本',
      fieldName: 'claimCost',
      precision: 2,
      disabled: true
    }
  ];
};

// 折扣率
export const createDiscountFormList = function() {
  return [
    {
      type: 'INPUT_NUMBER',
      label: '折扣率',
      fieldName: 'DISCOUNT',
      disabled: false,
      min: 0,
      max: 1,
      isControls: false,
      initialValue: 1,
      onEnter: val => {
        this.handleDiscountEnter(val);
      }
    }
  ];
};
